<?php
	include("../connect.php");
	
	$sql="SELECT *, 
				 DATE_FORMAT(ngay_dang,'%d-%m-%Y') AS ngay FROM mau_tin_td , 
				 linh_vuc_td  
		  WHERE mau_tin_td.ms_linh_vuc = linh_vuc_td.ms_linh_vuc 
		  		AND mau_tin_td.giay_phep = 1 
				AND (
						vi_tri_can_tuyen LIKE N'%$tim%' 
						OR ten_nha_td LIKE N'%$tim%' 
						OR noi_dang = N'%$tim%' 
						OR noi_lam_viec LIKE N'%$tim%' 
						OR noi_dung LIKE N'%$tim%') 
				AND DATE_ADD(ngay_dang, INTERVAL thoi_gian_song DAY) > NOW() 
		  ORDER BY mau_tin_td.ngay_dang DESC";
	$rs=mysql_query($sql);
	
	$so_luong_td = mysql_num_rows($rs);
	
	$sql1="SELECT *, 
				 DATE_FORMAT(ngay_dang,'%d-%m-%Y') AS ngay FROM mau_tin_rv
		  WHERE giay_phep = 1
				AND DATE_ADD(ngay_dang, INTERVAL thoi_gian_song DAY) > NOW() 
				AND (
						tieu_de LIKE N'%$tim%'
						OR noi_dung LIKE N'%$tim%'
						OR noi_dang LIKE N'%$tim%'
					)
		  ORDER BY vip DESC, ngay_dang DESC";
	$rs1=mysql_query($sql1);
		  
	$so_luong_rv = mysql_num_rows($rs1);
?>
<div class="article">
<h2><a class="link" onClick="tim1('tim')">Tin tuyển dụng <font color="#FF0000">(<?php echo $so_luong_td ?>)</font></a></h2>
<h2><a class="link" onClick="tim2('tim')">Tin rao vặt <font color="#FF0000">(<?php echo $so_luong_rv ?>)</font></a></h2>
</div><br/>
<input type="hidden" name="tim" id="tim" value="<?php echo $tim ?>" />
<div id="kq"></div>